[fix] Process symlinked routes#4957
[fix] Process symlinked routes#4957Rich-Harris merged 5 commits intosveltejs:masterfrom mikenikles:process-symlinked-routes
Conversation
🦋 Changeset detectedLatest commit: 3980e3c The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
mrkishi
left a comment
There was a problem hiding this comment.
As per @Conduitry's comment, this would error on symlinks to files, as readdirSync throws when not called on a directory.
There seems to be a problem with Node's fs.readdirSync(dir, { withFileTypes: true }) returning false for isDirectory() on symlinks (open issue at nodejs/node#30646). It doesn't seem likely to get fixed upstream in a timely manner, so reverting to fs.statSync instead of withFileTypes seems like a better solution.
|
Thank you folks, I reverted to the |
|
Thank you for the follow-up! What should we do about the test? On Windows, the system's developer mode would have to be enabled as well as Git's We could add |
Co-authored-by: Maurício Kishi <mrkishi@users.noreply.github.com>
|
Interesting, I see the tests on Windows passed with the latest commit, but failed previously - although I don't think it was because of the new test I added 🤔. To make sure we have stable tests though, I agree that it's likely ok to skip on Windows. However, can you guide me into how I can exclude my sym-link test in a Windows environment? |
mrkishi
left a comment
There was a problem hiding this comment.
Alright, I pushed changes so tests are skipped when symlinks don't make it through git.
lgtm.
|
thank you! |
|
Hey guys! Thanks again @mikenikles for your help ! Windows SymlinksPrerequisitesSymlink PermissionsYou have 1 of 3 options. If you try to create a symlink without one of these, you will see: 🟦 Option 1: Run as AdministratorWhen you make a symlink this way, you'll always need to open up the terminal as an 🟦 Option 2: Developer ModeThis is the easiest way but not the safest (security risk).
✅ Option 3: Local Security Policy
+ Security Settings > Local Policies > User Rights Assignment > Create symbolic links
Choose a Path:
|
Fixes #4936.
Process files within sym-linked directories.
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm testand lint the project withpnpm lintandpnpm checkChangesets
pnpm changesetand following the prompts. All changesets should bepatchuntil SvelteKit 1.0